﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:odc="clr-namespace:Odyssey.Controls" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Odyssey;Component/Themes/BreadcrumbBar/Brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!--BreadcrumbButton-->
    <Style TargetType="{x:Type odc:BreadcrumbButton}">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Background" Value="{StaticResource mouseOverBtnBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">

            <Setter.Value>
                <ControlTemplate TargetType="{x:Type odc:BreadcrumbButton}">
                    <Grid Margin="{TemplateBinding Padding}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <odc:AeroChrome Grid.Column="0" Visibility="Visible" x:Name="button" Focusable="False"
                                Margin="-1" BorderThickness="1" RenderPressed="{TemplateBinding IsPressed}"
                                RenderMouseOver="{TemplateBinding IsMouseOver}">
                            <odc:AeroChrome.Content>
                                <StackPanel Orientation="Horizontal">
                                    <Image x:Name="image"
                                            Source="{Binding Image, RelativeSource={RelativeSource TemplatedParent}}"
                                            RenderOptions.BitmapScalingMode="NearestNeighbor"
                                            RenderOptions.EdgeMode="Aliased" ClipToBounds="True" Width="16" Height="16"
                                            Stretch="Fill" />
                                    <ContentPresenter Content="{TemplateBinding Header}"
                                            ContentTemplate="{TemplateBinding HeaderTemplate}" Margin="2,0,2,0" />
                                </StackPanel>
                            </odc:AeroChrome.Content>
                        </odc:AeroChrome>

                        <!--Content="{TemplateBinding Header}"/>-->
                        <odc:AeroChrome Grid.Column="1" x:Name="PART_DropDown" Focusable="False" MinWidth="16"
                                Margin="-1" BorderThickness="1" RenderPressed="{TemplateBinding IsDropDownPressed}"
                                RenderMouseOver="{TemplateBinding IsMouseOver}"
                                ContentTemplate="{TemplateBinding DropDownContentTemplate}">
                            <odc:AeroChrome.Content>
                                <Path x:Name="dropDownPath" Fill="Black" Data="{StaticResource RightArrow}"
                                        HorizontalAlignment="Center" />
                            </odc:AeroChrome.Content>
                            <odc:AeroChrome.ContextMenu>
                                <ContextMenu x:Name="PART_Menu" IsTextSearchEnabled="True" HorizontalOffset="-14"
                                        ItemContainerStyle="{x:Null}"
                                        IsOpen="{Binding IsDropDownPressed, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}">
                                    <ContextMenu.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <VirtualizingStackPanel Orientation="Vertical" CanVerticallyScroll="True"
                                                    CanHorizontallyScroll="False" Width="300" />
                                        </ItemsPanelTemplate>
                                    </ContextMenu.ItemsPanel>
                                    <ContextMenu.Template>
                                        <ControlTemplate TargetType="ContextMenu"
                                                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                                xmlns:s="clr-namespace:System;assembly=mscorlib"
                                                xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
                                            <mwt:SystemDropShadowChrome Color="#00FFFFFF" Name="Shdw" MaxHeight="400">
                                                <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
                                                        BorderBrush="{TemplateBinding Border.BorderBrush}"
                                                        Background="{TemplateBinding Panel.Background}">
                                                    <Grid>
                                                        <Rectangle RadiusX="2" RadiusY="2" Fill="#FFF1F1F1" Width="22"
                                                                Margin="2,2,2,2" HorizontalAlignment="Left" />
                                                        <Rectangle Fill="#FFE2E3E3" Width="1" Margin="25,2,0,2"
                                                                HorizontalAlignment="Left" />
                                                        <Rectangle Fill="#FFFFFFFF" Width="1" Margin="26,2,0,2"
                                                                HorizontalAlignment="Left" />
                                                        <ScrollViewer Margin="1,0,1,0" Grid.ColumnSpan="2"
                                                                VerticalScrollBarVisibility="Auto" Focusable="False">
                                                            <ItemsPresenter Margin="{TemplateBinding Control.Padding}"
                                                                    SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
                                                                    KeyboardNavigation.DirectionalNavigation="Cycle" />
                                                        </ScrollViewer>
                                                    </Grid>
                                                </Border>
                                            </mwt:SystemDropShadowChrome>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="ContextMenuService.HasDropShadow">
                                                    <Setter Property="FrameworkElement.Margin" TargetName="Shdw">
                                                        <Setter.Value>
                                                            <Thickness>0,0,5,5</Thickness>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="mwt:SystemDropShadowChrome.Color"
                                                            TargetName="Shdw">
                                                        <Setter.Value>
                                                            <Color>#71000000</Color>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Trigger.Value>
                                                        <s:Boolean>True</s:Boolean>
                                                    </Trigger.Value>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </ContextMenu.Template>
                                </ContextMenu>
                            </odc:AeroChrome.ContextMenu>
                        </odc:AeroChrome>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsImageVisible" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="image" />
                        </Trigger>
                        <Trigger Property="Image" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="image" />
                        </Trigger>
                        <Trigger Property="EnableVisualButtonStyle" Value="False">
                            <Setter TargetName="button" Property="MouseOverBackground" Value="Transparent" />
                            <Setter TargetName="button" Property="MousePressedBackground" Value="Transparent" />
                            <Setter TargetName="button" Property="BorderBrush" Value="Transparent" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Header" Value="{x:Null}" />
                                <Condition Property="IsImageVisible" Value="False" />
                                <Condition Property="Image" Value="{x:Null}" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="button" />
                        </MultiTrigger>
                        <Trigger Property="HasItems" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_DropDown" />
                        </Trigger>
                        <Trigger Property="Mode" Value="Overflow">
                            <Setter Property="Data" Value="{StaticResource OverflowArrow}" TargetName="dropDownPath" />
                            <Setter Property="Fill" Value="Transparent" TargetName="dropDownPath" />
                            <Setter Property="Stroke" Value="Black" TargetName="dropDownPath" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="RenderPressed" Value="True" TargetName="PART_DropDown" />
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter Property="RenderMouseOver" Value="True" TargetName="PART_DropDown" />
                            <Setter Property="RenderMouseOver" Value="True" TargetName="button" />
                        </Trigger>
                        <Trigger Property="IsDropDownVisible" Value="False">
                            <Setter TargetName="PART_DropDown" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" SourceName="PART_DropDown" />
                                <Condition Property="EnableVisualButtonStyle" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter Property="MouseOverBackground" Value="{StaticResource GradientBorderBrush}"
                                    TargetName="button" />
                        </MultiTrigger>
                        <Trigger Property="IsButtonVisible" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="button" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsDropDownPressed" Value="True" />
                                <Condition Property="Mode" Value="Breadcrumb" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Data" Value="{StaticResource DownArrow}" TargetName="dropDownPath" />
                            <Setter Property="RenderPressed" Value="True" TargetName="button" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>